StrictlyPositiveInt

@SinceKotoolsTypes(version = "1.1")
value class StrictlyPositiveInt constructor(val value: Int) : Comparable<Int>

Represents strictly positive integers, excluding 0.

Constructors

Link copied to clipboard

Returns the value as a strictly positive int, or throws an IllegalArgumentException if the value is negative.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
open infix operator override fun compareTo(other: Int): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: PositiveInt): Int
infix operator fun compareTo(other: StrictlyPositiveInt): Int

Compares this value with the other value for order. Returns 0 if this value equals the other value, a negative number if this value is less than the other value, or a positive number if this value is greater than the other value.

@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: NegativeInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: StrictlyNegativeInt): Int

Compares this value with the other value and returns a positive number for order.

Link copied to clipboard
operator fun dec(): StrictlyPositiveInt

Returns this value decremented by 1. If this value is the minimum, it returns the maximum value instead.

Link copied to clipboard
infix operator fun div(other: Int): Int
infix operator fun div(other: NegativeInt): NegativeInt
infix operator fun div(other: PositiveInt): PositiveInt

Divides this value by the other value, truncating the result to an integer that is closer to 0. Throws an ArithmeticException if the other value equals 0.

infix operator fun div(other: NonZeroInt): Int
infix operator fun div(other: StrictlyNegativeInt): NegativeInt
infix operator fun div(other: StrictlyPositiveInt): PositiveInt

Divides this value by the other value, truncating the result to an integer that is closer to 0.

Link copied to clipboard
operator fun inc(): StrictlyPositiveInt

Returns this value incremented by 1. If this value is the maximum, it returns the minimum value instead.

Link copied to clipboard
infix operator fun minus(other: Int): Int
infix operator fun minus(other: NegativeInt): StrictlyPositiveInt
infix operator fun minus(other: NonZeroInt): Int
infix operator fun minus(other: PositiveInt): Int
infix operator fun minus(other: StrictlyNegativeInt): StrictlyPositiveInt
infix operator fun minus(other: StrictlyPositiveInt): Int

Subtracts the other value from this value.

Link copied to clipboard
infix operator fun plus(other: Int): Int
infix operator fun plus(other: NegativeInt): Int
infix operator fun plus(other: NonZeroInt): Int
infix operator fun plus(other: PositiveInt): StrictlyPositiveInt
infix operator fun plus(other: StrictlyNegativeInt): Int

Adds the other value to this value.

Link copied to clipboard
infix operator fun times(other: Int): Int
infix operator fun times(other: NegativeInt): NegativeInt
infix operator fun times(other: NonZeroInt): NonZeroInt
infix operator fun times(other: PositiveInt): PositiveInt
infix operator fun times(other: StrictlyNegativeInt): StrictlyNegativeInt
infix operator fun times(other: StrictlyPositiveInt): StrictlyPositiveInt

Multiplies this value by the other value.

Link copied to clipboard

Returns this value as a non-zero int.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.2")
fun toNotBlankString(): NotBlankString

Returns the string representation of this value as a not blank string.

Link copied to clipboard

Returns this value as a positive int.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Returns the negative of this value.

Link copied to clipboard

Returns this value.

Properties

Link copied to clipboard
val value: Int